package com.aspose.cells;

public class ComboBox extends Shape {
   private Object b;
   String[] a;
   private int c;
   private boolean d;
   private int e = 8;

   ComboBox(ShapeCollection shapes) {
      super(shapes, 20, shapes);
      this.e = 8;
      this.d = false;
   }

   ComboBox(ShapeCollection shapes, Object embedded) {
      super(shapes, 20, shapes);
      this.b = embedded;
      this.N().h().a(true);
   }

   Object a() {
      return this.b;
   }

   int b() {
      if (this.a != null) {
         return this.a.length;
      } else if (this.v == null) {
         return 0;
      } else {
         Range var1 = this.Y();
         return var1 == null ? 0 : var1.getRowCount();
      }
   }

   public int getSelectedIndex() {
      return !this.d ? -1 : this.c;
   }

   public void setSelectedIndex(int value) {
      Cell var2 = this.e(true);
      if (var2 != null) {
         if (value >= 0) {
            var2.putValue(value + 1);
         } else {
            var2.putValue((String)null);
         }
      }

      if (value == -1) {
         this.d = false;
      } else if (value >= 0 && value <= 65535) {
         if (value >= this.b()) {
            throw new IllegalArgumentException("Invalid selected index.");
         } else {
            this.c = value;
            this.d = true;
         }
      } else {
         throw new IllegalArgumentException("Invalid selected index.");
      }
   }

   void a(int var1) {
      this.c = var1;
      this.d = true;
   }

   public String getSelectedValue() {
      if (this.a != null && this.d && (this.c & '\uffff') < this.a.length) {
         return this.a[this.c & '\uffff'];
      } else {
         Cell var1 = this.getSelectedCell();
         return var1 == null ? "" : var1.j();
      }
   }

   public Cell getSelectedCell() {
      if (this.v != null && this.d) {
         Range var1 = this.d(this.v);
         return var1 == null ? null : var1.getCellOrNull(this.c & '\uffff', 0);
      } else {
         return null;
      }
   }

   public boolean getShadow() {
      return this.z;
   }

   public void setShadow(boolean value) {
      this.z = value;
   }

   public int getDropDownLines() {
      return this.e;
   }

   public void setDropDownLines(int value) {
      this.e = value;
   }

   void a(ComboBox var1, CopyOptions var2) {
      super.a((Shape)var1, (CopyOptions)var2);
      this.e = var1.e;
      this.v = zyd.a(var1.L(), this.L(), var1.v, 0, 0, 0);
      this.c = var1.c;
      this.d = var1.d;
      if (var1.a != null) {
         this.a = var1.a;
      }

   }
}
